import { driver } from 'gremlin';

export class GremlinClient {
    private readonly remote: string;
    private readonly client: driver.Client;

    public constructor(remote?: string) {
        if (remote === undefined) {
            this.remote = 'ws://211.71.15.48:8182/gremlin';
        } else {
            this.remote = remote;
        }
        this.client = new driver.Client(this.remote, {
            traversalSource: 'g',
            mimeType: 'application/json',
        });
    }

    public async submit(cypher: string, bindings: object): Promise<void> {
        await this.client.submit(cypher, bindings);
    };
}
